<div class="bjui-pageHeader">
    <div class="pull-right">
        <button class="btn-default" data-icon="plus" title="新增分类" data-toggle="tooltip" data-placement="left" onclick="createDialog('{:U("Forms/groy")}', '新增分类', 'groy', {width:600, height:450})"></button>
        <button class="btn-default" data-icon="refresh" onclick="$.CurrentNavtab.navtab('refresh')"></button>
    </div>
    <form id="pagerForm" data-toggle="ajaxsearch" data-loadingmask="true" action="{:U('Index/save')}" method="post">
        <input type="hidden" name="pageSize" value="{:I('param.pageSize')}" />
        <input type="hidden" name="pageCurrent" value="{:I('param.pageCurrent')}" />
        <input type="hidden" name="orderField" value="{:I('param.orderField')}" />
        <input type="hidden" name="orderDirection" value="{:I('param.orderDirection')}" />
    </form>
</div>
<div class="bjui-pageContent tableContent">
    <table class="table table-bordered table-hover table-striped table-top groyTable" data-selected-multi="false">
        <thead>
            <tr>
                <th width="50">分类ID</th>
                <th>分类名称</th>
               <!--  <th width="140">手机显示名称</th> -->
                <th width="60">是否首页显示</th>
                <th width="60">状态</th>
                <th width="36">权重</th>
                <th width="100">操作</th>
            </tr>
        </thead>
        <tbody>
        <!--
            tr  class == groy1 是一级分类. groy2二级 开关事件,注意span.groys  和子元素的data-icon   plus && minus
        -->
       <volist name="list" id="vo">
        <tr class="groy{$vo.leve}">
            <td>{$vo.id}</td>
            <if condition="$vo.leve eq '1'">
            <td><span class="groys"><button class="btn-green btn-xs" data-icon="plus"></button>{$vo.name}</span></td>
            <elseif condition="$vo.leve eq '2'"/>
            <td style="padding-left: 8em;"><span class="groys"><button class="btn-green btn-xs" data-icon="minus"></button>{$vo.name}</span></td>
            <elseif condition="$vo.leve eq '3'"/>
            <td style="padding-left: 15em">{$vo.name}</td>
            </if>
            <!-- <td>{$vo.mobile_name}</td> -->
            <td><if condition="$vo.visibility eq '1'">是<else/>否</if></td>
            <if condition="$vo.status eq '0'">
            <td><a href="{:U('Forms/update_class_status',array('id'=>$vo['id']))}" data-type="get" data-toggle="doajax" data-confirm-msg="更改显示状态???">显示</a></td>
            <else/>
            <td><a href="{:U('Forms/update_class_status',array('id'=>$vo['id']))}" data-type="get" data-toggle="doajax" data-confirm-msg="更改关闭状态???">已关闭</a></td>
            </if>
            <td>{$vo.sort}</td>
            <td>
                <button type="button" class="btn-blue" onclick="createDialog('{:U("Forms/groy",array("id"=>$vo["id"]))}', '编辑分类', 'groy', {width:600, height:450})">改</button>
                <a href="{:U('Forms/del_goods_class',array('id'=>$vo['id']))}" data-type="get" class="btn btn-red" data-toggle="doajax" data-confirm-msg="要删除这个分类?">删</a>
            </td>
        </tr>
        </volist>
        </tbody>
    </table>
</div>
<script>
$(function () {
    $('.groys').click(function () {
        var par = $(this).parents('tr');
        var flag = $(this).find('i.fa').hasClass('fa-plus');
        flag ? ($(this).find('i.fa').addClass('fa-minus').removeClass('fa-plus')) : ($(this).find('i.fa').addClass('fa-plus').removeClass('fa-minus'));
        var cls = par.hasClass('groy2');
        par.nextAll('tr').each(function() {
            if( $(this).hasClass('groy1') ) {
                return false;
            }else{
                if( !cls ){
                    $(this).hasClass('groy2') && ($(this).find('span.groys i.fa').addClass('fa-minus').removeClass('fa-plus'));
                    flag ? ($(this).show()) : ($(this).hide());
                }else{
                    $(this).toggle();
                }

            }
        });
    });
});
    
</script>
<include file="Common/footer" ftype="page" />